package coreAuction;


public class Bid {
	private Customer bidCust;
	private Item bidItem;
	private double bidMoney;
	private enum BidState  {UNPROCESSED, FAILED, SUPERCEDED, WINNINGBID};
	private BidState bidState;

	
	public Bid(String itemID, String custID, double bidMoney, 
			         ItemList items, CustomerList custs) {
		
		this.bidCust = custs.find(custID);
		this.bidItem = items.find(itemID);
		this.bidMoney = bidMoney;
		bidState = BidState.UNPROCESSED;
	}

	public Customer getBidCust() {
		return bidCust;
	}
	public Item getBidItem() {
		return bidItem;
	}
	public double getBidMoney() {
		return bidMoney;
	}
	public String getBidState() {
		return bidState.toString();
	}



	public void setBidCust(Customer bidCust) {
		this.bidCust = bidCust;
	}
	public void setBidItem(Item bidItem) {
		this.bidItem = bidItem;
	}
	public void setBidMoney(double bidMoney) {
		this.bidMoney = bidMoney;
	}
	
	public void setFailed() { 
		bidState = BidState.FAILED;
	}
	
	public void setSuperceded () {
		bidState = BidState.SUPERCEDED;
	}
	
	public void setWinningBid() {
		bidState = BidState.WINNINGBID;
	}
	
	public String getReport() {
		String report = String.format("%6s", bidCust.getCustID()) 
		+ String.format("%20s",bidItem.getDescription()) +
				String.format("%6.2f", bidMoney) + "   " + bidState;		
		return report;
	
	
	}
	
	
	
}
